//
//  ZCLookResultVC.m
//  zctx
//
//  Created by apple on 15/10/20.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCLookResultVC.h"

@interface ZCLookResultVC ()<UIWebViewDelegate>
@property (nonatomic,strong)UIWebView *webView;
@end

@implementation ZCLookResultVC


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [MobClick beginLogPageView:@"ZCLookResultVC"];
    [MTA trackPageViewBegin:@"ZCLookResultVC"];
}
- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"ZCLookResultVC"];
    [MTA trackPageViewEnd:@"ZCLookResultVC"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self initnavegation];
    [self.navigationItem setTitle:[NSString stringWithFormat:@"%@检测书",self.nameStr]];
    [self initWebView];
    
}

#pragma mark 导航栏
-(void)initnavegation{
    UIButton * leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
    leftButton.frame = CGRectMake(0, 0, 19, 36);
    [leftButton setImage:[UIImage imageNamed:@"navigation_back"] forState:UIControlStateNormal];
    [leftButton addTarget:self action:@selector(backButtonPressed) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem * barButtonItem_leftNavBar = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
    self.navigationItem.leftBarButtonItem = barButtonItem_leftNavBar;
}

-(void)backButtonPressed{
    ProgressDismiss;
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)initWebView{
    self.webView = [[UIWebView alloc]init];
    self.webView.delegate = self;
    self.webView.scalesPageToFit = YES;
    [self.view addSubview:self.webView];
    [self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
       make.edges.equalTo(self.view).with.insets(UIEdgeInsetsMake(0, 0,0,0));
    }];
    NSURL *url = [NSURL URLWithString:self.url];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [self.webView loadRequest:request];
    
}

//加载开始
- (void)webViewDidStartLoad:(UIWebView *)webView{
    ProgressHUDStr;
}
//加载完成
-(void)webViewDidFinishLoad:(UIWebView *)webView{
    ProgressDismiss;
}
//加载出错
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
    [SVProgressHUD showErrorWithStatus:@"载入失败"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
